cmake_minimum_required(VERSION 3.0)
project(aaa C CXX)

set(CMAKE_VERBOSE_MAKEFILE ON)

add_library(printhello-objs OBJECT hhh.cpp)
set_target_properties(printhello-objs PROPERTIES POSITION_INDEPENDENT_CODE 1)

add_library(printhello-static STATIC $<TARGET_OBJECTS:printhello-objs>)
set_target_properties(printhello-static PROPERTIES OUTPUT_NAME "printhello")

add_library(printhello-shared SHARED $<TARGET_OBJECTS:printhello-objs>)
set_target_properties(printhello-shared PROPERTIES OUTPUT_NAME "printhello")

add_executable(${PROJECT_NAME} a.cpp)
target_link_libraries(${PROJECT_NAME} printhello-static)

